//
// Created by 33145 on 2023/4/3.
//
#include "chat_server.h"
#include "sylar/log.h"

// static sylar::Logger::ptr g_logger = SYLAR_LOG_ROOT();

void run() {
  chat::ChatServer::ptr server(new chat::ChatServer);
  sylar::Address::ptr addr = sylar::Address::LookupAnyIPAddress("0.0.0.0:8080");
  if(!addr) {
    // SYLAR_LOG_ERROR(g_logger) << "get address error";
    return;
  }
  while(!server->bind(addr)) {
    // SYLAR_LOG_ERROR(g_logger) << "bind " << *addr << " fail";
    sleep(1);
  }
  server->start();
}

int main() {
  sylar::IOManager iom(2);
  iom.schedule(run);
}